package hu.diploma.core.entity;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

@Entity
@Table(name = "person_table")
public class Person extends BaseEntity {

	@OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	@JoinColumn(name = "structuredname_table_id")
	private StructuredName structuredName;

	@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy = "person")
	private List<Address> addresses;

	@ManyToMany(fetch = FetchType.LAZY, mappedBy = "people")
	private List<Group> groups;

	@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy = "person")
	private List<PersonalData> personalDatas;

	public StructuredName getStructuredName() {
		return structuredName;
	}

	public void setStructuredName(StructuredName structuredName) {
		this.structuredName = structuredName;
	}

	public List<Address> getAddresses() {
		return addresses;
	}

	public void setAddresses(List<Address> addresses) {
		this.addresses = addresses;
	}

	public List<Group> getGroups() {
		return groups;
	}

	public void setGroups(List<Group> groups) {
		this.groups = groups;
	}

	public List<PersonalData> getPersonalDatas() {
		return personalDatas;
	}

	public void setPersonalDatas(List<PersonalData> personalDatas) {
		this.personalDatas = personalDatas;
	}

}
